﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Users;
using Lists;
using Sim;

namespace Sim
{
    public class Login : ILogin
    {
        int ILogin.Validate(string user, string pass)
        {
            UserList.DeserializeFromXML();
            bool isLoggedin = false;

            while (!isLoggedin)
            {
                for (int i = 0; i < UserList.userList.Count(); i++)
                {

                    if (user == UserList.userList[i].username && pass == UserList.userList[i].password)
                    {
                        return 1;

                    }
                    //else if (user != UserList.userList[i].username)
                    //{
                    //    return 0;
                    //}
                    //else
                    //{
                    //    return 0;
                    //}
                }
                break;
            }
            return 0;
        }
    }
}
